{% extends 'base.html' %}

<!-- 格言 -->
{% block maxims %}
{% if maxim %}
    {{maxim.words}}
{% else %}
    失败是成功之母。
{% endif %}
{% endblock %}

<!-- 页面主要标签设置 -->
{% block pageSetting %}{% endblock %}


<!-- 次导航条部分用于分类导航 -->
{% block category %}
{% if category %}
    {% for c in category %}
        <li><a href="?category={{c.id}}">{{ c.category }}</a></li>
    {% endfor %}
{% else %}
    <li class="subNavList_1"><a href="#">Blog</a></li>
    <li class="subNavList_2"><a href="#">技术</a></li>
    <li class="subNavList_3"><a href="#">Software</a></li>
    <li class="subNavList_4"><a href="#">Online tools</a></li>
{% endif %}
{% endblock %}

{% block content %}
{% if selectedBlog %}
    <h3>{{selectedBlog.category}}</h3>
    <div id="listBlog">
      <h3>{{selectedBlog.title}}</h3>
          {{selectedBlog.content|escape|linebreaks}}
      <br/>
      {% for photo in selectedBlog.blogimage_set.all %}
        <img src="/upload_media/{{photo.image}}" class="" alt=""/>
	{{photo.detail|escape|linebreaks}}
      {% endfor %}
      <p id="blogDetail">{{selectedBlog.pub_date.date}}</p>
    </div>
    <!-- 评论部分 -->
    <div style="border-bottom:1px dotted #999"></div>
    {% for c in comment %}
        <br/>
        <p id="displayName">
          {{ c.name }}
        </p>
        <p id="displayDate">
          {{ c.pub_date }}
        </p>
        <p id="displayMessage">
          {{ c.comment|escape|linebreaks }}
        </p>
        <div style="border-bottom:1px dotted #999"></div>
    {% endfor %}
    <br/>
{% else %}
    <h3>没有该日志信息</h3>
    <p>No data...</p>
    <div style="border-bottom:1px dotted #999"></div>
    <br/>
{% endif %}
<br/>
<h3>评论一下:</h3>
<form method="post" id="" action="/blog/leavecomment/">
<fieldset>
<legend>用户信息</legend>
  <span class="feedback">{{ noName }}</span>
<p>
  <label for="name">姓名:<em class="required"> (必填)</em></label>
  <input name="name" id="name" type="text" value="{{myName}}" />
</p>
<p>
  <label for="email">邮件:</label>
  <input name="email" id="email" type="text" value="{{myMail}}" class="longInput"/>
</p>
<p>
  <label for="url">网址:</label>
  <input name="url" id="url" type="text" value="{{myWeb}}" class="longInput"/>
</p>
</fieldset>

<fieldset>
<legend>留言</legend>
<span class="feedback">{{noMessage}}</span>
<p>
  <label for="message">留言:<em class="required"> (必填)</em></label>
  <textarea name="message" id="text" cols="40"
	    rows="20">{{myMessage}}</textarea>
</p>
</fieldset>

<fieldset>
  <legend>记住我？</legend>
  <input type="radio" class="radio" name="remember" id="remember-yes" value="yes" />
  <label for="remember-yes" >Yes</label>
  <input type="radio" class="radio" name="remember" id="remember-no" value="no" checked="checked"/>
  <label for="remember-no" />No</label>
</fieldset>
<input type="hidden" name="blogId" value="{{selectedBlog.id}}">
<input name="submit" class="submit" type="submit" id="submit" value="Reply"/>
</form>
{% endblock %}

<!-- 照片 -->
{% block photourl %}{{randImage}}{% endblock %}
{% block photo %}{{randImage}}{% endblock %}

